#include <bits/stdc++.h>

using namespace std;

struct E{
	int l,r,x,y;
	bool operator < (const E &b)const{
		return b.l == l ? r < b.r: l < b.l;
	}
	E(int l = 0,int r = 0,int x = 0,int y = 0):l(l),r(r),x(x),y(y){}
};

set<E> s;
set<E>::iterator it;

int main (){
	int n,q;
	scanf("%d %d",&n,&q);
	s.insert(E(1,n,1,1));
	while(q--){
		int ans = 0;
		int x,y;scanf("%d %d",&x,&y);
		char op[5];scanf("%s",op);
		it = s.lower_bound(E(x,n+1,1,1)); it--;
		E o = *it;
		if(o.l <= x && o.r >= x){
			s.erase(it);
			if(op[0] == 'L'){
				ans = x - o.x + 1;
				s.insert(E(o.l,x-1,o.x,y+1));
				s.insert(E(x+1,o.r,o.x,o.y));
			}else{
				ans = y - o.y +  1;
				s.insert(E(o.l,x-1,o.x,o.y));
				s.insert(E(x+1,o.r,x+1,o.y));
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}
	
